<?php
namespace app\admin\validate;

use think\Validate;

class TechnValidate extends Validate
{
    protected $rule =   [
        'id'            => 'require|number',
        'shop_id'       => 'require|number',
        'page'          => 'require|number',
        'limit'         => 'require|number',
        'name'          => 'require|length:1,30',
        'phone'         => 'require|length:1,30',
        'techn_cate_id' => 'require',
        'head_img'      => 'require|image',
    ];
    
    protected $message  =   [
        'id.require'            => 'ID必须',
        'id.number'             => 'ID必须是数字',
        'shop_id.require'       => '店铺不能为空',
        'shop_id.number'        => '店铺数据类型错误',
        'page.require'          => '页数不能为空',
        'page.number'           => '页数数据类型错误',
        'limit.require'         => '条数不能为空',
        'limit.number'          => '条数数据类型错误',
        'name.require'          => '姓名不能为空',
        'name.length'           => '姓名长度错误',
        'phone.require'         => '手机号不能为空',
        'phone.length'          => '手机号长度错误',
        'techn_cate_id.require' => '服务标签不能为空',
        'head_img.require'      => '头像不能为空',
        'head_img.image'        => '头像上传类型错误',
    ];
    
    protected $scene = [
        'show'         => ['id'],
        'list'         => ['page', 'limit'],
        'edit'         => ['id', 'name'],
        'add'          => ['name', 'shop_id', 'phone', 'techn_cate_id', 'head_img'],
        'edit'         => ['id', 'name', 'shop_id', 'phone', 'techn_cate_id'],
        'editImg'      => ['id', 'name', 'shop_id', 'phone', 'techn_cate_id', 'head_img'],
    ];
}